package com.next

class Job
{
    String name

    Boolean active = true

    Date createdDate = new Date()
    Date modifiedDate = new Date()

    static belongsTo = [company: Company]

    static constraints = {
        name unique: ['company'], maxSize: 32
        createdDate nullable: true, blank: true
        modifiedDate nullable: true, blank: true
    }

    static mapping = {
        sort 'name'
    }

    String toString()
    {
        name
    }

    def beforeUpdate()
    {
        modifiedDate = new Date()
    }
}
